<template>
  <el-dialog title="说明书详情"  :close-on-click-modal="false" :visible.sync="show" 
  class="dialog_index dialog_banner site_fixed form_detail"
   :before-close="cancle">
   <el-form ref="form" v-loading="loading" class="agency_form"> 
      <el-tabs type="card" v-model="activeName">
         <el-tab-pane :label="item.site" :name="item.site" v-for="item  in formList" :key="item.id">
            <el-form-item label="说明书标题：">{{item.instructions_title}}</el-form-item>
            <el-form-item label="连接示意图：" class="connection_diagram_container">
              <div class="connection_diagram">
                 <el-image :src="utils.setCdnUrl() + item.connection_diagram" v-show="item.connection_diagram" ></el-image>
              </div>
            </el-form-item>
            <el-form-item label="兼容信息：" >{{item.compatible_information}}</el-form-item>
            <el-form-item label="提示：" >{{item.prompt}}</el-form-item>
            <el-form-item label="产品参数：">{{item.product_parameters}}</el-form-item>
            <el-form-item label="注意事项：">{{item.matters_needing_attention}}</el-form-item>
            <el-form-item label="故障排除：">{{item.troubleshooting}}</el-form-item>
            <el-form-item label="技术支持：">
              <a :href="item.technical_support" target="_blank">{{item.technical_support}}</a></el-form-item>
        </el-tab-pane>
      </el-tabs>
     
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancle">关闭</el-button>
    </span>

   </el-dialog>
</template>

<script>
import { editGet } from '@/api/product/instructions.js'
export default {
  data () {
    return {
      formList:[],
      loading: false,
      activeName: '',
      image: '',
    }
  },
  props: {
    show: Boolean,
    closeDialog:Function,
    id:Number
  },
  watch: {
    show:function(){
      if(this.show){
        this.loading = true
        this.editGet()
      }
    }
  },
  methods: {
    editGet () {
      this.loading = true
      let params = {
        product_id: this.id
      }
      editGet(params).then(res=>{
        if(res.state == 1) {
          let data  = res.data
          this.formList = data
          this.image = data[0].httpImage
          this.activeName= data[0].site
        } else {
          this.$message.error(res.message)
        }
          this.loading = false
      })
    },
    cancle(){
      this.$emit('closeDialog')

    },
  },
 
}
</script>

<style lang="scss">

</style>